package org.example;

import org.example.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class App {
    public static void main(String[] args) {
//        法1
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
//法2
//        ApplicationContext context1=new FileSystemXmlApplicationContext("D:\\ideawork\\spring_08_ioc\\src\\main\\resources\\applicationContext.xml");
        BookDao bookDao=(BookDao) context.getBean("bookDao");


        bookDao.save();

    }
}
//beanfactory 是最开始的，具有延迟加载。
//Resource resource=new ClassPathResource("applicationContext.xml");
//BeanFactory beanFactory=new XmlBeanFactory(resource);
//BookDao bookDao=(BookDao) beanFactory.getBean("bookDao");
//bookDao.save();